﻿using System;
namespace Producers.Ehr.Xtee.Riik.Ee.Producer.Ehr {
    
    
    [global::Xtee.Core.Attributes.XmlTypeAttribute(Name="EN_OrgYldAndmed_query", Namespace="http://producers.ehr.xtee.riik.ee/producer/ehr", Target=typeof(ENOrgYldAndmedQuery))]
    public class ENOrgYldAndmedQuerySerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
        
        protected IENOrgYldAndmedQuery clazz;
        
        public ENOrgYldAndmedQuerySerializer(IENOrgYldAndmedQuery clazz) {
            this.clazz = clazz;
        }
        
        public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
            base.WriteXml(Writer);
            Writer.WriteStartElement("ehakkood");
            Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "integer");
            Writer.WriteString(new global::Xtee.Core.Schema.XsdInteger(((decimal)(clazz.Ehakkood))).ToString());
            Writer.WriteEndElement();
        }
        
        public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
            base.ReadXml(Reader);
        START:
            if ((Reader.LocalName == "ehakkood")) {
                goto ehakkood;
            }
            else {
                return;
            }
        ehakkood:
            if (Reader.IsElementNil()) {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>EN_OrgYldAndmed_query>ehakkood");
            }
            clazz.Ehakkood = new global::Xtee.Core.Schema.XsdInteger(Reader.ReadElementString("ehakkood")).Value;
            goto START;
        }
    }
}
